import 'package:flutter2/generated/json/base/json_convert_content.dart';
import 'package:flutter2/model/repay_entity.dart';

RepayEntity $RepayEntityFromJson(Map<String, dynamic> json) {
  final RepayEntity repayEntity = RepayEntity();
  final List<RepayPlanEntity>? plans = (json['wouldskiearly'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<RepayPlanEntity>(e) as RepayPlanEntity).toList();
  if (plans != null) {
    repayEntity.plans = plans;
  }
  return repayEntity;
}

Map<String, dynamic> $RepayEntityToJson(RepayEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['wouldskiearly'] = entity.plans.map((v) => v.toJson()).toList();
  return data;
}

extension RepayEntityExtension on RepayEntity {
  RepayEntity copyWith({
    List<RepayPlanEntity>? plans,
  }) {
    return RepayEntity()
      ..plans = plans ?? this.plans;
  }
}

RepayPlanEntity $RepayPlanEntityFromJson(Map<String, dynamic> json) {
  final RepayPlanEntity repayPlanEntity = RepayPlanEntity();
  final int? status = jsonConvert.convert<int>(json['biography']);
  if (status != null) {
    repayPlanEntity.status = status;
  }
  final int? repay = jsonConvert.convert<int>(json['need']);
  if (repay != null) {
    repayPlanEntity.repay = repay;
  }
  final int? cur = jsonConvert.convert<int>(json['leteastwardscreature']);
  if (cur != null) {
    repayPlanEntity.cur = cur;
  }
  final int? loan = jsonConvert.convert<int>(json['weddingdelicatebye']);
  if (loan != null) {
    repayPlanEntity.loan = loan;
  }
  final int? id = jsonConvert.convert<int>(json['embarrassnetwork']);
  if (id != null) {
    repayPlanEntity.id = id;
  }
  final int? overDays = jsonConvert.convert<int>(json['uniquepardonappear']);
  if (overDays != null) {
    repayPlanEntity.overDays = overDays;
  }
  final double? interest = jsonConvert.convert<double>(json['mrscruel']);
  if (interest != null) {
    repayPlanEntity.interest = interest;
  }
  final int? service = jsonConvert.convert<int>(json['fourthbreathdeaf']);
  if (service != null) {
    repayPlanEntity.service = service;
  }
  final String? repayTime = jsonConvert.convert<String>(json['africarequestdictionarycentre']);
  if (repayTime != null) {
    repayPlanEntity.repayTime = repayTime;
  }
  return repayPlanEntity;
}

Map<String, dynamic> $RepayPlanEntityToJson(RepayPlanEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['biography'] = entity.status;
  data['need'] = entity.repay;
  data['leteastwardscreature'] = entity.cur;
  data['weddingdelicatebye'] = entity.loan;
  data['embarrassnetwork'] = entity.id;
  data['uniquepardonappear'] = entity.overDays;
  data['mrscruel'] = entity.interest;
  data['fourthbreathdeaf'] = entity.service;
  data['africarequestdictionarycentre'] = entity.repayTime;
  return data;
}

extension RepayPlanEntityExtension on RepayPlanEntity {
  RepayPlanEntity copyWith({
    int? status,
    int? repay,
    int? cur,
    int? loan,
    int? id,
    int? overDays,
    double? interest,
    int? service,
    String? repayTime,
  }) {
    return RepayPlanEntity()
      ..status = status ?? this.status
      ..repay = repay ?? this.repay
      ..cur = cur ?? this.cur
      ..loan = loan ?? this.loan
      ..id = id ?? this.id
      ..overDays = overDays ?? this.overDays
      ..interest = interest ?? this.interest
      ..service = service ?? this.service
      ..repayTime = repayTime ?? this.repayTime;
  }
}